<?php
	header("Content-Type: text/html;charset=utf-8");
	include("function/_nosql.php");
	include("function/function.php");
	
	$classid = chkstr(trim($_REQUEST['classid']));
	$ac = chkstr(trim($_REQUEST['ac']));
	$search_text = chkstr(trim($_REQUEST['search_text']));
	if(is_numeric($classid)){
	
		$sql="select * from kboy_bigclass where id=$classid";
		$rows=mysql_query($sql);
		$nums=mysql_num_rows($rows);
		if($nums>0){
			$rs=mysql_fetch_array($rows);
			$bigclass_cn = $rs['bigclass_cn'];
		}else{
			echo erro("该信息不存在或已被删除1");
		}
	}else{
		echo erro("参数错误");
	}
	
	
	// 获取父ID串
	$replace_str = "1,2,3";
	getFatherID($classid,"");
	$getFatherID = $getFatherID . ",";
	$EXarr = explode(',',$replace_str);
	foreach($EXarr as $u){
		$rep_str = ','.$u.",";
		$getFatherID = str_replace($rep_str,'',$getFatherID);
	}
	$getFatherID = rtrim(ltrim($getFatherID,','),',');
	if(strlen($getFatherID)>0){
		$Farr = array_reverse(explode(",",$getFatherID));
		$FarrNum = $Farr[0];
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?= $bigclass_cn ?>_<?= $web_titles?></title>
<meta name="Keywords" content="<?= $bigclass_cn ?>,<?= $web_keywords ?>" />
<meta name="Description" content="<?= $web_description ?>" />
<link rel="stylesheet" href="css/common.css"/>
<link rel="stylesheet" href="css/sq.css"/>
<script type="text/javascript" src="js/baidutongji.js"></script>
<script type="text/javascript" src="js/laydate/laydate.js"></script>
</head>
<body>
    <!--top-bar begin-->
	<? include("_include.top.topbar.php") ?>
    <!--top-bar end-->
    <!--header begin-->
	<? include("_include.top.navbar.php") ?>
    <!--header end-->
    <!--banner begin-->
    <div class="sq-banner">
        <div class="inner-pic"><img src="images/sq_ban.jpg" alt=""/></div>
        <div class="sq-inner">
            <div class="search-box">
            </div>
				<?php
						if($_SESSION['kboy_userid']){
							$urls = "forum_travel_add.php?uid=".$_SESSION['kboy_userid'];
						}else{
							$urls = "login.php";
						}
				?>
            <div class="sq-1"><a href="<?=$urls?>">我要发贴 <i><img src="images/rect2.png" width="12" height="9" alt=""/></i></a></div>
            <div class="sq-1"><a href="user_index.php">个人中心</a></div>
        </div>
    </div>
    <!--banner end-->
    <!--活动 begin-->
    <div class="f-item-box">
        <div class="content">
            <div class="sq-standard">
                <div class="sq-l">
                    <ul class="pic">
						<?php
								$news_sql = "select * from kboy_piclink where news_bigclass=126 order by news_top desc,news_order desc, id desc limit 5";
								$news_rows = mysql_query($news_sql);
								while($news_rs = mysql_fetch_array($news_rows)){
									if($news_rs['news_tourls']){
										echo "<li><a href=\"".$news_rs['news_tourls']."\" target=\"_blank\"><img src=\"".$news_rs['news_pic']."\" width=\"870\" height=\"432\"></a></li>";
									}else{
										echo "<li><a href=\"javascript:void(0);\"><img src=\"".$news_rs['news_pic']."\" width=\"870\" height=\"432\"></a></li>";
									}
								}
						?>
                    </ul>
                    <div class="txt-bg"></div>
                    <div class="txt">
                        <ul>
						<?php
								$news_sql = "select * from kboy_piclink where news_bigclass=126 order by news_top desc,news_order desc, id desc limit 5";
								$news_rows = mysql_query($news_sql);
								while($news_rs = mysql_fetch_array($news_rows)){
									if($news_rs['news_tourls']){
										echo "<li><a href=\"".$news_rs['news_tourls']."\" target=\"_blank\">".$news_rs['news_title']."</a></li>";
									}else{
										echo "<li><a href=\"javascript:void(0);\">".$news_rs['news_title']."</a></li>";
									}
								}
						?>
                        </ul>
                    </div>
                    <ul class="num">
						<?php
								$i = 1;
								$news_sql = "select * from kboy_piclink where news_bigclass=126 order by news_top desc,news_order desc, id desc limit 5";
								$news_rows = mysql_query($news_sql);
								while($news_rs = mysql_fetch_array($news_rows)){
									if($i == 1){
										echo "<li class=\"on\"></li>";
									}else{
										echo "<li></li>";
									}
								$i ++ ;
								}
						?>
                    </ul>
                </div>
                <div class="sq-r">
                    <ul>
					
						<?php
								$i = 1;
								$news_sql = "select * from kboy_forum_travel order by id desc limit 6";
								$news_rows = mysql_query($news_sql);
								while($news_rs = mysql_fetch_array($news_rows)){
									if($i == 1){
										echo "<li class=\"on\">";
									}else{
										echo "<li>";
									}
									echo "<a href=\"forum_travelview.php?newsid=".$news_rs['id']."\" target=\"_blank\"><i><img src=\"".getClassName("kboy_user","user_face","uid=".$news_rs['uid'])."\" width=\"55\" height=\"55\" alt=\"\"/></i>".$news_rs['travel_title']."</a></li>";
								$i ++ ;	
								}
						?>
						
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <div class="f-item-box">
        <div class="content">
            <div class="sq-crumb">
                <div class="sq-c-t">
                    <div class="sq-h"><span><?=$bigclass_cn?></span></div>
                    <div class="sq-new-t"><a href="<?=$urls?>"><i><img src="images/wr.png" width="20" height="19" alt=""/></i>发新贴</a></div>
                    <div class="sq-search">
					    <form  >
						<input type="hidden" name="classid" value="<?=$classid;?>" />
                        <input type="text" name="search_text" class="search-text input_wby" value="搜索本版内容">
                        <input type="submit" class="search-send" value="">
						</form>
                    </div>
                </div>
                <div class="line"></div>
            </div>
			<?php
			                    
								$SQL = "";
								if($search_text){
								 $SQL = $SQL."  `travel_title` like '%".$search_text."%' ";
								}
								$pagesize = 10; // 分页数量
								$pageval = chkstr(trim($_REQUEST['page'])); // 获取Page的值
								if($pageval){
									if(!is_numeric($pageval)){
										echo erro("Page Error");
									}
									if($pageval <= 1){
										$pageval = 1;
									}
									$page = ($pageval-1) * $pagesize;
									$page .= ",";
								}else{
									$pageval = 1;
								}
								
								$ac = intval($_GET['ac']);
								if($ac==0){
								 $orders = " travel_addtime desc , ";
								}
								if($ac==1){
								 $orders = " travel_hit desc , ";
								}
								if($SQL != ""){
									$pagesql = "select * from kboy_forum_travel where ".$SQL." and travel_bigclass=$classid order by ".$orders." id desc";
								}else{
									$pagesql = "select * from kboy_forum_travel where travel_bigclass=$classid order by ".$orders." id desc";
								}

								$pagenum = mysql_num_rows(mysql_query($pagesql)); // 总记录数
			?>
            <div class="sq-lt-bd">
                <div class="sq-lt-nav">
				<a href="bbslist.php?classid=<?=$classid?>&ac=" class="navs navs1 <? if($ac==""){ echo "on";}?>">按发表时间拍讯</a>
				<a href="bbslist.php?classid=<?=$classid?>&ac=1" class="navs navs2 <? if($ac=="1"){ echo "on";}?>">按点击量排序</a>
				
				<span class="total">共计<i><?=$pagenum?></i>个信息</span></div>
                <div class="sq-lt-wrap">
                    <div class="sq-list">
						<?php
								$pagecount = ceil($pagenum/$pagesize); // 共分多少页
								if($pageval > $pagecount){
									$pageval = $pagecount;
								}
								
								$news_sql = $pagesql." limit $page $pagesize";
								$news_rows = mysql_query($news_sql);
								$i = 1;
								while($news_rs = mysql_fetch_array($news_rows)){
						?>
                        <div class="sq-list-item">
                            <dl>
                                <dt><a href="forum_travelview.php?newsid=<?=$news_rs['id']?>" target="_blank"><img src="<?=getClassName("kboy_user","user_face","uid=".$news_rs['uid'])?>" width="84" height="84" alt=""/></a></dt>
                                <dd>
                                    <div class="s-l-l">
                                        <h3 class="title"><a href="forum_travelview.php?newsid=<?=$news_rs['id']?>" target="_blank"><?=$news_rs['travel_title']?></a></h3>
                                        <div class="editor-inner">
                                            <span class="editor">作者：<a href="forum_travelview.php?newsid=<?=$news_rs['id']?>" target="_blank"><?=getUserNickName($news_rs['uid'])?></a></span>
                                            <span class="date">发表于：<?=$news_rs['travel_addtime']?></span>
                                            <div class="show-pl"><span class="watch"><i></i><?=$news_rs['travel_hit']?></span></div>
                                        </div>
                                        <div class="s-l-detail">
                                            <a href="forum_travelview.php?newsid=<?=$news_rs['id']?>" target="_blank"><?=cutstr_html(stripslashes($news_rs['travel_content']),100)?></a>
                                        </div>
                                    </div>
                                    <div class="s-l-r"><a href="forum_travelview.php?newsid=<?=$news_rs['id']?>" target="_blank"><img src="<?=$news_rs['travel_pic']?>" width="175" height="130" alt=""/></a></div>
                                </dd>
                            </dl>
                        </div>
						<?php
								} // while 完毕
						?>
                    </div>
						<?php
								if($pagenum > $pagesize){
									echo "<div class=\"pagination\"><ul>";
									$url = "bbslist.php?classid=$classid";//当前页面
									pagebar($pagecount, $pageval, 7, $url);
									echo "</ul></div>";
								}
						?>
                </div>
            </div>
        </div>
    </div>
    <!--foot begin-->
	<? include("_include.bottom.footbar.php") ?>
    <!--foot begin-->
    <!--左侧悬浮 begin-->
	<? include("_include.bottom.leftbar.php") ?>
    <!--左侧悬浮 end-->
    <!--右侧悬浮导航 begin-->
	<? include("_include.bottom.rightbar.php") ?>
    <!--右侧悬浮导航 end-->
    <script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="js/jquery.SuperSlide.2.1.1.js"></script>
    <script type="text/javascript" src="js/main.js"></script>
    <script type="text/javascript" src="js/sq.js"></script>
</body>
</html>
